package com.gitee.wsl.mathematics.matrix.mat3.ext

import com.gitee.wsl.mathematics.matrix.mat3.MutableMatrix3

@Suppress("NOTHING_TO_INLINE")  // it does make a difference (~25% faster)
internal inline fun <T:Number> MutableMatrix3<T, *, *>.mul(
    t00: T, t01: T, t02: T,
    t10: T, t11: T, t12: T,
    t20: T, t21: T, t22: T
){
    val r00 = m00 * t00 + m01 * t10 + m02 * t20
    val r10 = m10 * t00 + m11 * t10 + m12 * t20
    val r20 = m20 * t00 + m21 * t10 + m22 * t20

    val r01 = m00 * t01 + m01 * t11 + m02 * t21
    val r11 = m10 * t01 + m11 * t11 + m12 * t21
    val r21 = m20 * t01 + m21 * t11 + m22 * t21

    val r02 = m00 * t02 + m01 * t12 + m02 * t22
    val r12 = m10 * t02 + m11 * t12 + m12 * t22
    val r22 = m20 * t02 + m21 * t12 + m22 * t22

    m00 = r00; m01 = r01; m02 = r02
    m10 = r10; m11 = r11; m12 = r12
    m20 = r20; m21 = r21; m22 = r22

}